﻿@using KL.Store.Core
@{
    Layout = null;
    var QWproductDetailsFullClass = "col-xs-12 first last product-review";
    var QWproductImageClass = "col-xs-6 first last product-images";
    var QWproductDetailsClass = "col-xs-6 product-prices";
    if (Parameters.Theme == "HA")
    {
        QWproductDetailsFullClass = "col-xs-12 col-sm-12 col-md-12 col-lg-12 first last product-review";
        QWproductImageClass = "col-xs-12 col-sm-12 col-md-7 col-lg-7 first last product-images";
        QWproductDetailsClass = "col-xs-12 col-sm-12 col-md-5 col-lg-5 product-prices last";
    }
}
<div style="display: none;">
    <div id="quickViewContainer" class="@QWproductDetailsFullClass">
        <div class="@QWproductImageClass">
        </div>
        <div class="@QWproductDetailsClass">
            <div class="product-titles">
                <h1></h1>
                <div class="product-code"></div>
            </div>
            <div class="product-center">
                <div id="product-view-prices-div"></div>
                <div class="productAddToCart"></div>
                <div class="clearfix"></div>
                <div class="review">
                    <a href="#" class="btn btn-custom3"><i class="fa fa-search"></i>&nbsp;Ürünü İncele</a>
                </div>
            </div>
        <div class="clearfix"></div>
    </div>
</div>
</div>
<script>
    var productId = "";
    var productName = "";
    var productCode = "";
    var imageCount = "";
    var SliderString = "";
    var ProductUrl = "";
    $(".hizliBak").live("click", function ()
    {
        productId = $(this).data("id");
        productName = $(this).data("name");
        productCode = $(this).data("prcode");
        imageCount = $(this).data("imgcount");
        ProductUrl = "/p_" + productId + ".htm";
        $("#quickViewContainer .product-titles h1").html(productName);
        $("#quickViewContainer .product-titles .product-code").html('Ürün Kodu : ' + productCode);
        $("#quickViewContainer .product-center .review a").attr('href', ProductUrl);
        $("#quickViewContainer .product-center #product-view-prices-div").load('/Product/ProductPrices', { id: productId, pRelPos: 'bottom' });
        $("#quickViewContainer .product-center .productAddToCart").load('/Product/ProductAddToCart', { id: productId });

        SliderString += '<div class="product-flexslider qw">';
        SliderString += '<div id="slider" class="flexslider qw">';
        SliderString += '<ul class="slides qw">';
        if (imageCount >= 1)
        {
            for (var i = 1; i <= imageCount; i++)
            {
                SliderString += '<li class="qw">';
                SliderString += '<a href="javascript:void(0);" data-zoom-image="@(Parameters.WebSiteImageUrl)/product-big/' + productId + '_' + i + '.jpg"><img src="@(Parameters.WebSiteImageUrl)/product-large/' + productId + '_' + i + '.jpg" class="qw" /></a>';
                SliderString += '</li>';
            }
        }
        else
        {
            SliderString += '<li><img src="/Images/@(Parameters.Theme)/product-image-not-found-400x.jpg" /></li>';
        }
        SliderString += '</ul>';
        SliderString += '</div>';
        if (imageCount >= 1)
        {
            SliderString += '<div id="carousel" class="flexslider qw">';
            SliderString += '<ul class="slides qw">';
            for (var j = 1; j <= imageCount; j++)
            {
                SliderString += '<li class="qw">';
                SliderString += '<img src="@(Parameters.WebSiteImageUrl)/product-small/' + productId + '_' + j + '_w.jpg" class="qw" />';
                SliderString += '</li>';
            }
            SliderString += '</ul>';
            SliderString += '</div>';
        }
        SliderString += '</div>';
        $("#quickViewContainer .product-images").html(SliderString);


        $.fancybox.open({
            href: '#quickViewContainer',
            autoScale: true,
            width: 1000,
            //height: 450,
            fitToView: true,
            autoSize: false,
            autoDimensions: true,
            autoScale: true,
            type: 'inline',
            afterShow: function ()
            {
                $('.qw#carousel').flexslider({
                    animation: "slide",
                    controlNav: false,
                    animationLoop: false,
                    slideshow: false,
                    itemWidth: 94,
                    itemMargin: 5,
                    asNavFor: '.qw#slider'
                });
                $('.qw#slider').flexslider({
                    animation: "slide",
                    controlNav: false,
                    animationLoop: true,
                    slideshow: false,
                    sync: ".qw#carousel",
                });
            },
            afterClose: function ()
            {
                productId = "";
                productName = "";
                productCode = "";
                imageCount = "";
                SliderString = "";
                $("#quickViewContainer .product-images").html('');
                $("#quickViewContainer .product-titles h1").html('');
                $("#quickViewContainer .product-titles .product-code").html('');
                $("#quickViewContainer .product-center .review a").attr('href', '#');
                $("#quickViewContainer .product-center #product-view-prices-div").html('');
                $("#quickViewContainer .product-center .productAddToCart").html('');
                if (typeof RefreshCartSummary !== 'undefined' && $.isFunction(RefreshCartSummary))
                {
                    RefreshCartSummary();
                }
                if (typeof RefreshCart !== 'undefined' && $.isFunction(RefreshCart))
                {
                    RefreshCart();
                }
            }
        });

        //$(this).fancybox({
        //    width: 1000,
        //    height: 450,
        //    fitToView: false,
        //    autoSize: false,
        //    autoDimensions: false,
        //    autoScale: false,
        //    afterShow: function ()
        //    {
        //        $('.qw#carousel').flexslider({
        //            animation: "slide",
        //            controlNav: false,
        //            animationLoop: false,
        //            slideshow: false,
        //            itemWidth: 94,
        //            itemMargin: 5,
        //            asNavFor: '.qw#slider'
        //        });
        //        $('.qw#slider').flexslider({
        //            animation: "slide",
        //            controlNav: false,
        //            animationLoop: true,
        //            slideshow: false,
        //            sync: ".qw#carousel",
        //        });
        //    },
        //    afterClose: function ()
        //    {
        //        productId = "";
        //        productName = "";
        //        productCode = "";
        //        imageCount = "";
        //        SliderString = "";
        //        $("#quickViewContainer .product-images").html('');
        //        $("#quickViewContainer .product-titles h1").html('');
        //        $("#quickViewContainer .product-titles .product-code").html('');
        //        $("#quickViewContainer .product-center #product-view-prices-div").html('');
        //        $("#quickViewContainer .product-center .productAddToCart").html('');
        //    }
        //});


        //$("a#fancyBoxLink").fancybox({
        //    'href': '#myDivID',
        //    'titleShow': false,
        //    'transitionIn': 'elastic',
        //    'transitionOut': 'elastic'
        //});
    });
</script>
